package org.gbis.openbus.db;

import java.sql.*;

import org.gbis.openbus.*;

import com.sbmoon.db.*;
import com.sbmoon.web.Request;

public class DbManagerNearStation extends DbManager {

	@Override
	public String getSqlFileName() {
		return "sql200_stationSearch.sql";
	}

	@Override
	public Item getItem(QueryResult qr) {
		Station station = new Station();

		station.setId( qr.getString("id"));
		station.setNo( qr.getString("no"));
		station.setName( qr.getString( "name"));
		station.setX( qr.getDouble("x"));
		station.setY( qr.getDouble("y"));
		station.setDist( (int) (  Math.floor( qr.getDouble("dist") ) ) );

		return station;
	}

	private DbManagerNearStation() {
	}

	public static DbManagerNearStation getDbManager() {
		if( true ) {
			return new DbManagerNearStation();
		}
		return dbManager;
	}

	private static final DbManagerNearStation dbManager = new DbManagerNearStation();

	public static void main(String[] args) throws Exception {

		SearchResult searchResult = SearchResult.getNewSearchResult();

		getDbManager().getSearchResult( true, searchResult , 200616 , 418560, 400 );

	}

}
